#!/usr/bin/python
# -*- coding: utf-8 -*-
#Create Time : 2006-6-7 12:26:26
#Create By User : oguard


import dpkt
import pcap
import rconfig
import struct

receive_arp = pcap.pcap( name=rconfig.CONF_INTERFACE )
receive_arp.setfilter( 'arp' )
print dir( receive_arp )

for recv_time, recv_pkt in receive_arp:
    #print recv_time
    recv_data = dpkt.arp.ARP( recv_pkt )
    
    #print struct.unpack( '6s', recv_data.tha ), '---tager HA'
    #print `recv_data.tpa`, '---tager IP'
    #print `recv_data.sha`, '---source HA'
    #print `recv_data.spa`, '---Source IP'
    print `recv_data.op`, '---OPT'
    #print `recv_data.data`
    #print dir(recv_data.pack_hdr())